Version 0.1 (beta)
by Stian Ellingsen
http://quaddux.promanex.net/gmsee/
Email: gmsee@quaddux.promanex.net
The Game Maker Sound Engine Extension was made as a replacement for the sound_frequency function, which was removed in Game Maker 6.0. GMSEE uses a slightly different system for handling sounds than Game Maker. The sounds are loaded as resources and several instances of one sound can be created and controlled individually. Note that a resource or an instance created and used in GMSEE can not be used directly in Game Maker.
Some functions will return NaN (“Not a Number”) if they fail. This value can’t be expressed in Game Maker code, but you can test wether a value is NaN in the following way:
if(var==0 && var<0) // That makes perfect sense, doesn’t it?
show_message('The variable equals NaN!');
First release (beta).
The following scripts can be found in GMSEE.gm6. To use them in your Game Maker project, you can merge GMSEE.gm6 to your project.
Initializes the DLL. This function must be called before using any other functions.
Returns: 1.
Frees the memory used by the DLL. This function should be called when the DLL isn’t needed anymore.
Returns: 1.
Loads a resource from the indicated .wav file. The wave file should be in PCM format, preferably 44.1 kHz 16-bit mono. The Sound data will be resampled to this format if necessary (this might take some time). All data will be loaded into memory, so loading long sounds or many sounds is not recommended. Also note that a GMSEE resource is not the same as a Game Maker resource.
Returns: The resource identifier on success or -1 on failure.
Frees the indicated resource. This should be called if the resource is no longer needed.
Returns: 1 on success, 0 on failure.
Creates and initializes a sound instance, using the indicated resource. The sound will not start playing before you call gmsee_play or gmsee_loop. Note that every instance has a processor thread with maximum priority. If you play too many instances at the same time, the CPU usage may cause the system to stop responding. Also note that a GMSEE instance is not the same as a Game Maker instance.
Returns: The instance identifier on succes or -1 on failure.
Frees the indicated instance. This should be called when the instance will not be used anymore.
Returns: 1 on success, 0 on failure.
Starts playing the indicated instance from its current position and disables looping. It will only play until it reaches the end of the sound.
Returns: 1 on success, 0 on failure.
Start looping the indicated instance from its current position. It will play until it is freed or until gmsee_pause or gmsee_stop is called.
Returns: 1 on success, 0 on failure.
Pauses the indicated instance.
Returns: 1 on success, 0 on failure.
Stops the indicated instance and resets its position. Note that you can start playing an instance after having stopped it. You will need to call FreeInstance to remove the instance completely.
Returns: 1 on success, 0 on failure.
Sets how fast the indicated sound instance will play. 1 is the default speed. If the value is negative, the sound will play backwards, and the position will be set to the end of the data instead of the beginning when the instance is stopped.
Returns: 1 on success, 0 on failure.
Controls the volume of the indicated instance. The amplitude of the original sound is multiplied by the indicated value. 1 (max) is the default value.
Returns: 1 on success, 0 on failure.
Controls the difference in the volume between left and right channel. -1 is left channel only, 0 is 100 % on both channels, 1 is right channel only, 0.6 is 40 % on left and 100 % on right etc.
Returns: 1 on success, 0 on failure.
Sets the data position of the indicated instance. 0 is at the beginning if the data,1 is at the end.
Returns: 1 on success, 0 on failure.
Returns wether the instance is currently playing.
Returns: Wether playing (1) or not (0), or NaN on failure.
Returns wether the instance loops when reaching the end of the sound. This may be true even when the sound is paused.
Returns: Wether loop is enabled (1) or not (0), or NaN on failure.
Returns the playback speed of the indicated instance. See gmsee_set_frequency for more details.
Returns: The current playback speed, or NaN on failure.
Returns the volume of the indicated instance. See gmsee_set_volume for more details.
Returns: The current volume, or NaN on failure.
Returns the panning of the indicated instance. See gmsee_set_pan for more details.
Returns: The current panning, or NaN on failure.
Returns the data position of the indicated instance. See gmsee_set_position for more details.
Returns: The current data position, or NaN on failure.